import logging
from urllib import parse


def is_url(string):
    try:
        result = parse.urlparse(string)
        if result.scheme not in ('http', 'https'):
            logging.info("[validator] wrong scheme, expect http or https, got={}".format(result.scheme))
            return False
        if not result.netloc:
            logging.info("[validator] wrong domain, got={}".format(result.netloc))
            return False
    except Exception:
        return False

    return True
